const path = require('path');
const webpack = require('webpack');

const { TestCompilerPlugin, FactoryParserHook } = require('./plugins/test-compiler-plugin');
const { TestCompilationPlugin } = require('./plugins/test-compilation-plugin');
const TestIntercept = require('./plugins/test-intercept-plugin');

const config = {
  entry: path.resolve(__dirname, 'index.js'),

  output: {
    path: path.resolve(__dirname, 'dist'),
    clean: true,
  },
  resolve: {
    extensions: ['.jsx', '.js'],
  },
  module: {
    rules: [
      {
        test: /\.jsx?$/,
        use: 'babel-loader',
        include: [__dirname],
      },
    ],
  },
  mode: 'development', // development production
  optimization: {
    runtimeChunk: true,
    splitChunks: {
      chunks: 'all',
    },
  },

  plugins: [
    new TestCompilerPlugin(),
    new TestCompilationPlugin(['Module', 'Chunk', 'Record', 'Assets', 'Other']),
    new FactoryParserHook(),
    // new TestIntercept(),
  ],
};

module.exports = config;
